package cj.web.admin.dao;
/*
 *  
 *  
*/
import java.util.List;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.admin.domain.CallCenterInfo;

/**
 * 
 * @author 
 *
 */
@DAO
public interface CallCenterInfoDAO{
	
	@SQL("SELECT id,name,phone,link,deleteFlag,createUser,date_format(createAT,'%Y-%m-%d %H:%i:%s') as createAT,updateUser,date_format(updateAT,'%Y-%m-%d %H:%i:%s') as updateAT FROM CallCenterInfo WHERE deleteFlag=1 AND name like '%##(:1)%' ORDER BY updateAT DESC LIMIT :2,:3 ")
    List<CallCenterInfo> query(String name,int start,int length);
	
	@SQL("SELECT count(id) FROM CallCenterInfo WHERE deleteFlag=1 AND name like '%##(:1)%'")
	int querysize(String name);
    
    @SQL("select * from CallCenterInfo where id=:1")
    CallCenterInfo queryById(int id);
    
    @SQL("INSERT INTO CallCenterInfo (name,phone,link,deleteFlag,createUser,createAT,updateUser,updateAT) VALUES (:t.name,:t.phone,:t.link,:t.deleteFlag,:t.createUser,now(),:t.updateUser,now())")
    void create(@SQLParam("t") CallCenterInfo callCenterInfo);
	
	@SQL("UPDATE CallCenterInfo SET name=:t.name,phone=:t.phone,link=:t.link,updateUser=:t.updateUser,updateAT=now() WHERE id=:t.id")
    void update(@SQLParam("t") CallCenterInfo callCenterInfo);
    
    @SQL("UPDATE CallCenterInfo SET deleteFlag=0 WHERE id=:1")
    void deleteById(int id);
}